package cn.udinghuo.model.archives.yxy;

import com.fasterxml.jackson.annotation.JsonSetter;

import org.springframework.util.Assert;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Column;
import cn.udinghuo.core.domain.entity.BaseEntity;	
import cn.udinghuo.model.archives.yxy.TenantSource;	
import cn.udinghuo.core.domain.entity.Comment;
import cn.udinghuo.core.domain.entity.ita.CacheKey;

/**
 * @author ssk
 *	营销云租户关系
 */
@Entity
@Table(name="yxycorp")
public class Tenant extends BaseEntity<Long>  {

	private static final long serialVersionUID = -167772161L;
	/**
	* 租户IDtenantId
	*/
	@Comment(value="租户ID")
	@Column(name="cTenantId")
	private String tenantId;
	/**
	* 税号taxNo
	*/
	@Comment(value="税号")
	@Column(name="cTaxNo")
	private String taxNo;
	/**
	* 订货企业IDcorpId
	*/
	@Comment(value="订货企业ID")
	@Column(name="iCorpId")
	private Long corpId;
	/**
	* 租户来源source
	*/
	@Comment(value="租户来源")
	@Column(name="iSource")
	private Short source;
	public String getTenantId() {
		return this.tenantId;
	}
	
	public void setTenantId(String value) {
		this.tenantId = value;
	}
	
	public String getTaxNo() {
		return this.taxNo;
	}
	
	public void setTaxNo(String value) {
		this.taxNo = value;
	}
	
	public Long getCorpId() {
		return this.corpId;
	}
	
	public void setCorpId(Long value) {
		this.corpId = value;
	}
	
	public TenantSource getSource() {
        if(this.source == null){
			return null;
		}
		return TenantSource.find(this.source.intValue());
	}
	@JsonSetter
	public void setSource(TenantSource value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.source = value.getValue();
	}
	
	public void setSource(Short value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(TenantSource.find(value.intValue()),"enum value is invalid value!"); 
		this.source = value;
	}
	
}
